<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>arguments对象(实例2)</title>
</head>

<body>
    <p>计算所有参数之和：</p>
    <p id="demo"></p>
    <script>
        function sumAll() {
            var i, sum = 0;
            for (i = 0; i < arguments.length; i++) {
                sum += arguments[i];
            }
            return sum;
        }
        document.getElementById("demo").innerHTML = sumAll(1, 123, 500, 115, 44, 88);
    </script>
</body>

</html>